package com.runen.infinitemovement.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;
import com.runen.infinitemovement.model.entity.RouteDetailsEntity;
import com.runen.infinitemovement.tool.CommonUtil;
import com.runen.infinitemovement.tool.GlideUtils;
import com.runen.infinitemovement.widget.imageview.RoundedCornersImage;

/**
 * Create by LiaoDuanHong
 * Create on 2020/09/02 17:02
 */
public class HeardPictureAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private Context context;

    public HeardPictureAdapter(Context context) {
        super(R.layout.item_head_picture);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        int position = helper.getLayoutPosition();
        //为0是不折叠（核心）
        if (position == 0) {
            CommonUtil.setMargins(helper.itemView, 0, 0, 0, 0);
        }
        RoundedCornersImage rci_header = helper.getView(R.id.rci_header);
        if (null != item) {
            GlideUtils.loadImage(context, item+"?x-oss-process=image/resize,m_fill,w_144,h_144", rci_header);
        } else {
            GlideUtils.loadImage(context, CommonUtil.getDrawable(R.mipmap.ic_launcher), rci_header);
        }
    }
}
